package com.wyd.command.cmd;

import java.util.List;

/**
 * @author Yudi Wang
 * @date 2022/1/27 16:42
 */
public class AllOffCommand implements Command {
    private List<Command> commands;

    public AllOffCommand(List<Command> commands) {
        this.commands = commands;
    }

    public void execute() {
        for (int i = 0; i < commands.size(); i++) {
            commands.get(i).execute();

        }
    }

    public void undo() {
        for (int i = commands.size(); i >= 0; i--) {
            commands.get(i).undo();
        }
    }
}
